<?php
namespace common\models;

use Yii;
use yii\base\Model;

/**
 * Lexicon
 */
class Lexicon extends Model{

    /**
     * 获得表名
     */
    public static function getTableName($lexicon){
        $tableName = '';
        $lexicon = strtolower($lexicon);
        switch($lexicon){
            case 'junior' : $tableName = '{{%lexicon_junior}}';break;
            default : '';
        }
        return $tableName;
    }

    public static function getConfig($lexicon){
        $lexicon = strtolower($lexicon);
        switch($lexicon){
            case 'all' : return [
                    'tableName' => '{{%lexicon}}',
                    'where' => ' WHERE TRUE',
                ];
            case 'junior' : return [
                    'tableName' => '{{%lexicon_junior}}',
                    'where' => ' WHERE w.junior=1',
                ];
            default : return [
                'tableName' => '',
                'where' => '',
            ];
        }
        return $tableName;
    }


}
